<%@page pageEncoding="utf-8" contentType="text/html; charset=utf-8" %>
<%@ include file="/admin/include/init_admin.jsp" %>
<%@ page import="com.joinhawaii.home.*" %>
<%
	String board_id			= StringUtil.nvl(request.getParameter("board_id"));
	String search_col		= StringUtil.nvl(request.getParameter("search_col"), "subject");
	String search_word		= StringUtil.toHan(StringUtil.nvl(request.getParameter("search_word")));
	String curr_page 		= StringUtil.nvl(request.getParameter("s_curr_page"), "1");


	String search_url		= "./boardList.jsp?board_id="+board_id+"&search_col="+search_col+"&search_word="+search_word;

	HashMap infos = new HashMap();
	infos.put("board_id",		board_id);
	infos.put("search_col",		search_col);
	infos.put("search_word",	search_word);
	infos.put("curr_page",		curr_page);

	StringUtil.setPaging("/board.xml", "select_word_total", infos);

	BoardDAO boardDAO 		= new BoardDAO();
	HashList boardList		= boardDAO.selectBoardList(infos);
	HashList wordList 		= boardDAO.selectWordList(infos);

	//int totalCount 			= boardDAO.selectWordCount(infos);
	//int totalPage			= boardDAO.getTotalPage(totalCount);

%>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
	<meta http-equiv="Content-Type" content="text/html; charset=utf-8"/>
	<title>조인하와이</title>
	<%@ include file="/admin/include/cssnjs.jsp"  %>
	<script>
	$(document).ready(function() {
		$('#list').find('tr').hover(
				function () { $(this).addClass("hover"); }
			  , function () { $(this).removeClass("hover"); }
			)
			.click(function(){
				$('#word_id').val($(this).attr('word_id'));
				$('#searchForm').attr('action', './boardView.jsp');
				$('#searchForm').submit();
			});
	});
	</script>
</head>
<body>
<div id="wrap">
	<div id="top">
		<%@ include file="/admin/include/top.jsp" %>
	</div>
	<div id="page">
		<div id="menu">
			<%@ include file="/admin/include/leftMenu.jsp" %>
		</div>
		<div id="contents">
			<div class="menu_title">
				<h1>업무게시판</h1>
				<p>관리자 > 견적관리 > <b>업무게시판</b></p>
			</div>
			<div class="clear line_01"></div>

            <form name="searchForm" id="searchForm" action="./boardList.jsp">
            <input type="hidden" name="board_id" value="<%= board_id %>"/>
            <input type="hidden" name="word_id" id="word_id" value=""/>
            <input type="hidden" name="s_curr_page" value="<%=curr_page%>"/>

			<div class="mt10 mb10 r">
				<select name="search_col"  style="width:80px; valign:absmiddle">
                  <option value="subject" <%= StringUtil.selected("subject", search_col) %>>제목</option>
                  <option value="content" <%= StringUtil.selected("content", search_word) %>>내용</option>
                  <option value="author_name" <%= StringUtil.selected("author_name", search_word) %>>글쓴이</option>
                </select>
                <input type="text" name="search_word" size="5" style="width:146px;" value="<%= search_word %>" class="input2" />
                <input type="image" src="/images/admin/btn_search.gif" class="button"/>
                <a href="./boardView.jsp?board_id=<%= board_id %>&job_type=C"><img src="../images/admin/btn_register.gif" /></a>
			</div>

            </form>

			<table cellpadding="0" cellspacing="0" class="table_03">
				<colgroup>
					<col width="100px"/>
					<col />
					<col width="100px"/>
					<col width="100px"/>
					<col width="80px"/>
				</colgroup>
				<thead>
					<tr>
						<th><p>번호</p></th>
						<th><p>제목</p></th>
						<th><p>글쓴이</p></th>
						<th><p>날짜</p></th>
						<th><p>조회</p></th>
					</tr>
				</thead>
				<tbody id="list">

       <%
         String prevWordNum = "";
         for (int i = 0; i < wordList.size(); i++) {

       %>
                      <tr word_id="<%=wordList.get("word_id",i) %>">
                        <td>
                        <%			if (prevWordNum.equals(wordList.get("word_num",i))) {	%>
										&nbsp;
						<%			} else {	%>
										<%= wordList.get("word_num",i) %>
						<%			}	%>
                        </td>
                        <td class="l">
<%			if (!"0".equals(wordList.get("depth",i)))
		 	{
%>			 		<span style="padding-left:<%= 20 * (wordList.getInt("depth",i)-1) %>px">&nbsp;</span>
					<img src="/img/icon/ico_re_i.gif">
<%			}	%>

                        <a href="./boardView.jsp?word_id=<%=wordList.get("word_id",i) %>&board_id=<%=board_id %>&search_col=<%=search_col%>&search_word=<%=search_word%>&s_curr_page=<%=curr_page%>"><%= wordList.get("subject",i) %></a>
                        <% 	if ("Y".equals(wordList.get("new_yn",i))) { %>
								<img src="/images/icon/ico_new.gif">
						<%	} %>
						<% 	if ("Y".equals(wordList.get("hit_yn",i))) { %>
								<img src="/images/icon/ico_hot.gif">
						<%	} %>
                       	</td>
                        <td align="center" valign="middle"><%= wordList.get("author_name",i) %></td>
                        <td align="center" valign="middle"><%= wordList.get("init_date",i) %>&nbsp;</td>
                        <td align="center" ><%= wordList.get("count",i) %></td>
                      </tr>
   <%
       				prevWordNum = wordList.get("word_num",i);
         } %>
         			</tbody>
                </table>

				<div class="paging">
					<%= StringUtil.getPageHtml(infos, "./boardList.jsp?board_id="+board_id) %>
				</div>


		</div>
	</div>
</div>
</body>
</html>
